package cn.sxt.userscenter.common.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.springframework.stereotype.Component;

/**
 * 文件的工具类
 * @author Administrator
 *
 */
@Component("fileUtil")
public class FileUtil {
	/**
	 * 读取输入流所对应的文件
	 * @param is
	 * @return
	 */
	public String readFile(InputStream is)
	{
		StringBuffer sb = new StringBuffer() ; 
		BufferedReader br = null ; 
		try
		{
			br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
			String line = "" ; 
			while((line = br.readLine()) != null)
			{
				sb.append(line + "\r\n");
			}
		}catch (Exception e)
		{
			ConstatFinaUtil.LOGGER.error("报错了",e);
		}
		return sb.toString() ; 
	}
}
